<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.infodms.dms.common.Constant"%>

<%
	String contextPath = request.getContextPath();
%>
<%@taglib uri="/jstl/cout" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<jsp:include page="${contextPath}/common/jsp_head_new.jsp" />
<title>批发申请审核</title>
<script type="text/javascript">
function txtClr(valueId) {
		document.getElementById(valueId).value = '' ;
	}
</script>
</head>
<body onunload='javascript:destoryPrototype();' onload=""> 
<div class="wbox">
	<div class="navigation"><img src="<%=contextPath%>/img/nav.gif" />&nbsp;当前位置：  整车销售 &gt; 库存管理 &gt; 批发申请审核</div>
	<form id="fm" name="fm" method="post">
		<input type="hidden" name="curPage" id="curPage" value="1" />
		<input type="hidden" id="dlrId" name="dlrId" value="" />
		<table class="table_query" border="0">
		<c:if test="${returnValue==2}">
		<tr>
		<td  colspan="2"><font color="red">注意事项:</font></td>
	</tr>
		<tr>
		<td  colspan="2"><font color="red">1、大区内一级服务中心批发给一级服务中心——区域销售主管审核</font></td>
		</tr>
		<tr>
		<td  colspan="2"><font color="red">2、跨区或跨网批发——订单管理室赖从东审核。</font></td>
		</tr>
		<tr>
		<td  colspan="2"><font color="red">3、一级服务中心批发给二级经销商--无需审核，直接入二级经销商库房。</font></td>
		</tr>
		</c:if>
			<tr>
				<td width="20%" class="tblopt"><div align="right">调出经销商：</div></td>
				<td width="39%" >
      				<input name="outDealerCode" type="text" id="outDealerCode" class="middle_txt" value="" size="20" />
                    <input name="dlbtn" type="button" class="mini_btn" onclick="showOrgDealer('outDealerCode','','true', '', 'true');" value="..." />
                    <input type="button" class="normal_btn" onclick="txtClr('outDealerCode');" value="清 空" id="clrBtn" />
    			</td>
			</tr>
			<tr>
				<td width="20%" class="tblopt"><div align="right">调入经销商：</div></td>
				<td width="39%" >
      				<input name="inDealerCode" type="text" id="inDealerCode" class="middle_txt" value="" size="20" />
                    <input name="dlbtn" type="button" class="mini_btn" onclick="showOrgDealer('inDealerCode','','true', '', 'true');" value="..." />
                    <input type="button" class="normal_btn" onclick="txtClr('inDealerCode');" value="清 空" id="clrBtn" />
    			</td>
			</tr>
			<tr>
				<td width="20%" class="tblopt"><div align="right">物料组选择：</div></td>
				<td>
					<input type="text" id="materialCode" name="materialCode" class="middle_txt" value="" size="20"  />
					<input name="button3" type="button" class="mini_btn" onclick="showMaterialGroup('materialCode','materialName','true','');" value="..." />
					<input type="button" class="normal_btn" onclick="txtClr('materialCode');" value="清 空" id="clrBtn" />
				</td>
			</tr>
			<tr>
				<td width="20%" class="tblopt"><div align="right">VIN：</div></td>
				<td width="39%" >
      				<textarea id="vin" name="vin" cols="18" rows="3" ></textarea>
    			</td>
				<td class="table_query_3Col_input" >
					<input type="button" class="normal_btn" onclick="__extQuery__(1);" value=" 查  询  " id="queryBtn" /> 
				</td>
			</tr>
		</table>
	<jsp:include page="${contextPath}/queryPage/orderHidden.html" />
	<jsp:include page="${contextPath}/queryPage/pageDiv.html" />
	</form>
</div>
<form  name="form1" id="form1">
<table class="table_query" width="85%" align="center" border="0"  id="roll">
	<tr>
		<td width="10%" align="right">审批意见：</td>
 		<td width="23%">
 		 	<label>
 		 		<textarea id="checkDesc" name="checkDesc" cols="20" rows="3"></textarea>
  			</label>
  		</td>
  		<td width="59%">
  			<label>
  			<input type="hidden" name="checkStatus" id="checkStatus" />
  			<input type="hidden" name="transferIdsA" id="transferIdsA" />
			    <input type="button" class="normal_btn" onclick="check(1);" value="同意" />
			    <input type="button" class="normal_btn" onclick="check(0);" value="驳回" />
  			</label>
  		</td>
	</tr>
</table>
</form>
<script type="text/javascript"><!--
	document.form1.style.display = "none";
	
	var HIDDEN_ARRAY_IDS=['form1'];

	var myPage;
	
	var url = "<%=contextPath%>/sales/storageManage/VehicleDispatch/vehicleDispatchCheckList.json?COMMAND=1";
	
	var title = null;
	
	var columns = [
				{id:'action',header: "<input type='checkbox' name='checkAll' onclick='selectAll(this,\"transferIds\")' />全选", width:'6%',sortable: false,dataIndex: 'TRANSFER_ID',renderer:myCheckBox},
				{header: "批发号", dataIndex: 'TRANSFER_NO', align:'center'},
				{header: "调出经销商", dataIndex: 'OUT_DEALER', align:'center'},
				{header: "调入经销商", dataIndex: 'IN_DEALER', align:'center'},
				{header: "批发原因", dataIndex: 'TRANSFER_REASON', align:'center'},
				{header: "VIN", dataIndex: 'VIN',renderer:mySelect, align:'center'},
				{header: "发动机号", dataIndex: 'ENGINE_NO', align:'center'},
				{header: "物料名称", dataIndex: 'MATERIAL_NAME', align:'center'},
				{header: "申请日期", dataIndex: 'TRANSFER_DATE', align:'center'},
				{header: "首次入库日期", dataIndex: 'STORAGE_DATE', align:'center'}
		      ];
		      
	function myCheckBox(value,metaDate,record){
		return String.format("<input type='checkbox' name='transferIds' value='" + value + "' />");
	}

	function check(value){
		var transferIds = document.getElementsByName("transferIds");
		var addFlag = false;
		for(var i=0; i<transferIds.length; i++){
			if(transferIds[i].checked){
				addFlag = true;
				break;
			}
		}
		if(addFlag){
			MyConfirm("是否提交?",checkAction,[value]);
		}else{
			MyAlert("请选择审批信息!");
		}
	}
	
	function checkAction(value){
		var checkDesc = document.getElementById("checkDesc").value;	//审核意见
		var transferIds="";											//审核信息id
		var transferIds__ = document.getElementsByName("transferIds");
		if(transferIds__.length){
			for(var i=0; i< transferIds__.length; i++){
				if(transferIds__[i].checked){
					transferIds=transferIds+transferIds__[i].value+",";
				}
			}
		}
		document.getElementById("checkStatus").value = value ;
		document.getElementById("transferIdsA").value = transferIds ;
		//return;
		//value=1:同意；value=0：驳回
		
		makeNomalFormCall('<%=contextPath%>/sales/storageManage/VehicleDispatch/vehicleDispatchCheckSubmit.json',showResult,'form1');
	}

	function showResult(json){
		txtClr('checkDesc') ;
		turnQuery();
	}
	
	function turnQuery() {
		 __extQuery__(1);
		
	}
	function mySelect(value,meta,record){
	  	return String.format("<a href=\"#\" onclick='vehicleInfo(\""+value+"\")';>"+value+"</a>");
	}
	function vehicleInfo(value){
		OpenHtmlWindow('<%=contextPath%>/sales/storageManage/VehicleInfo/vehicleInfoQuery.do?vin='+value,700,500);
	}
</script>    
</body>
</html>